local nya__biyue = fk.CreateSkill {

  name = "nya__biyue",

  tags = { Skill.Compulsory, },

}



nya__biyue:addEffect(fk.EventPhaseStart, {
  name = "nya__biyue",
  frequency = Skill.Compulsory,
  anim_type = "drawcard",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(nya__biyue.name) and player.phase == Player.Finish
  end,
  on_use = function(self, event, target, player, data)
    local tos = {}
    player.room.logic:getEventsOfScope(GameEvent.ChangeHp, 999, function(e)
      local damage = e.data
      if damage then
        table.insertIfNeed(tos, damage.to.id)
      end
    end, Player.HistoryTurn)
    local n = not player:hasSkill("nya__play", true) and 2 or 1
    player:drawCards(math.min(n + #tos, 5), nya__biyue.name)
  end,
})

return nya__biyue